// export function datetime(current: number[]) {
//   if (!current) {
//     return '';
//   }
//   return `${current[0]}-${current[1] < 10 ? `0${current[1]}` : current[1]}-${
//     current[2] < 10 ? `0${current[2]}` : current[2]
//   } ${current[3] < 10 ? `0${current[3]}` : current[3]}:${
//     current[4] < 10 ? `0${current[4]}` : current[4]
//   }:${current[5] < 10 ? `0${current[5]}` : current[5]}`;
// }
const datetime = (takeAt: any) => {
  if (!takeAt) {
    return '';
  }
  if (typeof takeAt === 'string') {
    return takeAt;
  }
  const newtakeAt: string[] = [];
  const symbolList = ['-', '-', ' ', ':', ':', ''];
  let res = '';
  if (takeAt.length === 5) {
    takeAt.push(0);
  }
  takeAt.forEach((item: any) => {
    if (item < 10) {
      newtakeAt.push(`0${item}`);
    } else {
      newtakeAt.push(item.toString());
    }
  });
  newtakeAt.forEach((item, index) => {
    res += `${item}${symbolList[index]}`;
  });
  return res;
};

const datetimeWithoutSecond = (takeAt: any) => {
  // 未修改
  if (!takeAt) {
    return '';
  }
  if (typeof takeAt === 'string') {
    return takeAt;
  }
  const newtakeAt: string[] = [];
  const symbolList = ['-', '-', ' ', ':', ''];
  let res = '';
  if (takeAt.length === 4) {
    takeAt.push(0);
  }
  takeAt.forEach((item: any, index) => {
    if (index < 5) {
      if (item < 10) {
        newtakeAt.push(`0${item}`);
      } else {
        newtakeAt.push(item.toString());
      }
    }
  });
  newtakeAt.forEach((item, index) => {
    res += `${item}${symbolList[index]}`;
  });
  return res;
};
export { datetime, datetimeWithoutSecond };
